\(\int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx\) [453]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 52 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{a^{3/2} d}-\frac {\cot (c+d x)}{a d} \]

[Out]

-cot(d*x+c)/a/d-arctan((a+b)^(1/2)*tan(d*x+c)/a^(1/2))*(a+b)^(1/2)/a^(3/2)/d

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3274, 331, 211} \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{a^{3/2} d}-\frac {\cot (c+d x)}{a d} \]

[In]

Int[Cot[c + d*x]^2/(a + b*Sin[c + d*x]^2),x]

[Out]

-((Sqrt[a + b]*ArcTan[(Sqrt[a + b]*Tan[c + d*x])/Sqrt[a]])/(a^(3/2)*d)) - Cot[c + d*x]/(a*d)

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 331

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*c
*(m + 1))), x] - Dist[b*((m + n*(p + 1) + 1)/(a*c^n*(m + 1))), Int[(c*x)^(m + n)*(a + b*x^n)^p, x], x] /; Free
Q[{a, b, c, p}, x] && IGtQ[n, 0] && LtQ[m, -1] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 3274

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.)*((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> With[{ff
 = FreeFactors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(d*ff*x)^m*((a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(p
+ 1)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m}, x] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {1}{x^2 \left (a+(a+b) x^2\right )} \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {\cot (c+d x)}{a d}-\frac {(a+b) \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\tan (c+d x)\right )}{a d} \\ & = -\frac {\sqrt {a+b} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{a^{3/2} d}-\frac {\cot (c+d x)}{a d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.52 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {-\sqrt {a+b} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )-\sqrt {a} \cot (c+d x)}{a^{3/2} d} \]

[In]

Integrate[Cot[c + d*x]^2/(a + b*Sin[c + d*x]^2),x]

[Out]

(-(Sqrt[a + b]*ArcTan[(Sqrt[a + b]*Tan[c + d*x])/Sqrt[a]]) - Sqrt[a]*Cot[c + d*x])/(a^(3/2)*d)

Maple [A] (verified)

Time = 1.49 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.06

method result size
derivativedivides \(\frac {-\frac {1}{a \tan \left (d x +c \right )}+\frac {\left (-a -b \right ) \arctan \left (\frac {\left (a +b \right ) \tan \left (d x +c \right )}{\sqrt {a \left (a +b \right )}}\right )}{a \sqrt {a \left (a +b \right )}}}{d}\) \(55\)
default \(\frac {-\frac {1}{a \tan \left (d x +c \right )}+\frac {\left (-a -b \right ) \arctan \left (\frac {\left (a +b \right ) \tan \left (d x +c \right )}{\sqrt {a \left (a +b \right )}}\right )}{a \sqrt {a \left (a +b \right )}}}{d}\) \(55\)
risch \(-\frac {2 i}{a d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a \left (a +b \right )}-2 a -b}{b}\right )}{2 a^{2} d}+\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a \left (a +b \right )}+2 a +b}{b}\right )}{2 a^{2} d}\) \(121\)

[In]

int(cot(d*x+c)^2/(a+b*sin(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/a/tan(d*x+c)+1/a*(-a-b)/(a*(a+b))^(1/2)*arctan((a+b)*tan(d*x+c)/(a*(a+b))^(1/2)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 95 vs. \(2 (44) = 88\).

Time = 0.31 (sec) , antiderivative size = 290, normalized size of antiderivative = 5.58 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\left [\frac {\sqrt {-\frac {a + b}{a}} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (4 \, a^{2} + 5 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 4 \, {\left ({\left (2 \, a^{2} + a b\right )} \cos \left (d x + c\right )^{3} - {\left (a^{2} + a b\right )} \cos \left (d x + c\right )\right )} \sqrt {-\frac {a + b}{a}} \sin \left (d x + c\right ) + a^{2} + 2 \, a b + b^{2}}{b^{2} \cos \left (d x + c\right )^{4} - 2 \, {\left (a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 2 \, a b + b^{2}}\right ) \sin \left (d x + c\right ) - 4 \, \cos \left (d x + c\right )}{4 \, a d \sin \left (d x + c\right )}, \frac {\sqrt {\frac {a + b}{a}} \arctan \left (\frac {{\left ({\left (2 \, a + b\right )} \cos \left (d x + c\right )^{2} - a - b\right )} \sqrt {\frac {a + b}{a}}}{2 \, {\left (a + b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 2 \, \cos \left (d x + c\right )}{2 \, a d \sin \left (d x + c\right )}\right ] \]

[In]

integrate(cot(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/4*(sqrt(-(a + b)/a)*log(((8*a^2 + 8*a*b + b^2)*cos(d*x + c)^4 - 2*(4*a^2 + 5*a*b + b^2)*cos(d*x + c)^2 + 4*
((2*a^2 + a*b)*cos(d*x + c)^3 - (a^2 + a*b)*cos(d*x + c))*sqrt(-(a + b)/a)*sin(d*x + c) + a^2 + 2*a*b + b^2)/(
b^2*cos(d*x + c)^4 - 2*(a*b + b^2)*cos(d*x + c)^2 + a^2 + 2*a*b + b^2))*sin(d*x + c) - 4*cos(d*x + c))/(a*d*si
n(d*x + c)), 1/2*(sqrt((a + b)/a)*arctan(1/2*((2*a + b)*cos(d*x + c)^2 - a - b)*sqrt((a + b)/a)/((a + b)*cos(d
*x + c)*sin(d*x + c)))*sin(d*x + c) - 2*cos(d*x + c))/(a*d*sin(d*x + c))]

Sympy [F]

\[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\int \frac {\cot ^{2}{\left (c + d x \right )}}{a + b \sin ^{2}{\left (c + d x \right )}}\, dx \]

[In]

integrate(cot(d*x+c)**2/(a+b*sin(d*x+c)**2),x)

[Out]

Integral(cot(c + d*x)**2/(a + b*sin(c + d*x)**2), x)

Maxima [A] (verification not implemented)

none

Time = 0.35 (sec) , antiderivative size = 50, normalized size of antiderivative = 0.96 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {{\left (a + b\right )} \arctan \left (\frac {{\left (a + b\right )} \tan \left (d x + c\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{\sqrt {{\left (a + b\right )} a} a} + \frac {1}{a \tan \left (d x + c\right )}}{d} \]

[In]

integrate(cot(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="maxima")

[Out]

-((a + b)*arctan((a + b)*tan(d*x + c)/sqrt((a + b)*a))/(sqrt((a + b)*a)*a) + 1/(a*tan(d*x + c)))/d

Giac [A] (verification not implemented)

none

Time = 0.47 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.63 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {{\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac {a \tan \left (d x + c\right ) + b \tan \left (d x + c\right )}{\sqrt {a^{2} + a b}}\right )\right )} {\left (a + b\right )}}{\sqrt {a^{2} + a b} a} + \frac {1}{a \tan \left (d x + c\right )}}{d} \]

[In]

integrate(cot(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="giac")

[Out]

-((pi*floor((d*x + c)/pi + 1/2)*sgn(2*a + 2*b) + arctan((a*tan(d*x + c) + b*tan(d*x + c))/sqrt(a^2 + a*b)))*(a
 + b)/(sqrt(a^2 + a*b)*a) + 1/(a*tan(d*x + c)))/d

Mupad [B] (verification not implemented)

Time = 14.54 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.85 \[ \int \frac {\cot ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\mathrm {cot}\left (c+d\,x\right )}{a\,d}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {a+b}}{\sqrt {a}}\right )\,\sqrt {a+b}}{a^{3/2}\,d} \]

[In]

int(cot(c + d*x)^2/(a + b*sin(c + d*x)^2),x)

[Out]

- cot(c + d*x)/(a*d) - (atan((tan(c + d*x)*(a + b)^(1/2))/a^(1/2))*(a + b)^(1/2))/(a^(3/2)*d)